﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace BaMusaSoft.RPS.ViewModel.Infrastructure
{
    public abstract class Workspace : ViewModelBase
    {
        private RelayCommand _closeCommand;
        public abstract string DisplayName { get; protected set; }
        public abstract bool HasChanges { get; }

        public ICommand CloseCommand
        {
            get { return _closeCommand ?? (_closeCommand = new RelayCommand(OnRequestClose, OnCanClose)); }
        }

        public event EventHandler RequestClose;
        
        /// <summary>
        /// This Defaulted to return true. When override give your own implementation.
        /// </summary>
        /// <returns></returns>
        protected virtual bool OnCanClose()
        {
            return true;
        }

        public void OnRequestClose()
        {
            EventHandler handler = RequestClose;
            if (handler != null) handler(this, EventArgs.Empty);
        }
        public object MessageToken
        {
            get { return new Guid(); }
        }
        
       
            
        
    }
}